package com.example.clients;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.entity.PageVO;
import com.example.entity.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "product-services")
public interface ProductFeignClient {

    @RequestMapping("/product/{id}")
    public ResponseEntity<Product> findProductById(@PathVariable Integer id);


    @GetMapping("/products")
    ResponseEntity<List<Product>> findAllProducts() ;

    @GetMapping("/product-page")
    ResponseEntity<PageVO>  findProductPage(
            @RequestParam(value="current",required = false,defaultValue = "1") Integer current,
            @RequestParam(value="pageSize",required = false,defaultValue = "10") Integer pageSize);

    @PostMapping("/product")
    ResponseEntity <String> addProduct(@RequestBody Product product) ;

    @PutMapping("/product")
    ResponseEntity <String> updateProduct(@RequestBody Product product);

    @DeleteMapping("/product/{id}")
    ResponseEntity <String> deleteProduct(@PathVariable Integer id);


}
